import request from '../../utils/request'
const loginAPI = ({ mobile, code }) => {
  return request({
    method: 'POST',
    url: '/v1_0/authorizations',
    data: {
      mobile,
      code
    }
  })
}
// 获取资料
const userInfoAPI = () => {
  return request({
    url: '/v1_0/user'
  })
}
// 获取编辑资料
const userProfileAPI = () => {
  return request({
    url: '/v1_0/user/profile'
  })
}
// 修改头像
const updatePhotoAPI = (form) => {
  return request({
    url: '/v1_0/user/photo',
    method: 'PATCH',
    data: form
    // 如果你的请求体内容是表单对象, 浏览器会自动携带请求头Content-Type为multipart/form-data
  })
}
// 更新资料
const updateProfileAPI = ({ birthday, name }) => {
  return request({
    url: '/v1_0/user/profile',
    method: 'PATCH',
    data: {
      birthday,
      name
    }
  })
}
export {
  loginAPI,
  userInfoAPI,
  userProfileAPI,
  updatePhotoAPI,
  updateProfileAPI
}
